package com.hamny.gwt.media.client;


public class Navigator {

	private Navigator() {
	}

	public static final native void getUserMedia(
			MediaStreamConstraints constraints,
			NavigatorUserMediaSuccessCallback successCallback,
			NavigatorUserMediaErrorCallback errorCallback)
	/*-{

		var onSuccess = function(stream) {
			successCallback.@com.hamny.gwt.media.client.NavigatorUserMediaSuccessCallback::callback(*)(stream);
		}

		var onFailure = function(error) {
			errorCallback.@com.hamny.gwt.media.client.NavigatorUserMediaErrorCallback::callback(*)(error);
		}

		var navigator = $wnd.navigator;
		navigator.getUserMedia = navigator.getUserMedia
				|| navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
		navigator.getUserMedia(constraints, onSuccess, onFailure);

	}-*/;
}
